package com.edu.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.edu.bean.CommonResult;
import com.edu.service.CarService;
import com.edu.service.CarinfoService;
import com.edu.service.impl.CarinfoServiceImpl;
import com.edu.service.impl.CarsServiceImpl;
@WebServlet("/deletecarinfo.do")
public class DelectCarinfoServlet extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		CarinfoService cs = new CarinfoServiceImpl();
		String id = req.getParameter("carinfoid");
		int carinfoid = Integer.parseInt(id);
		int i = cs.delectcarinfo(carinfoid);
		CommonResult result = new CommonResult();
		if(i == 1) {
			result.setCode(200);
			result.setMessage("success");
		}else {
			result.setCode(409);
			result.setMessage("fali");
		}
		resp.setContentType("application/json;charset=utf-8");
		resp.getWriter().write(result.toJsonString());
	}
}
